package token

import (
	"crypto/rsa"
	"errors"
	"time"
)

var (
	ErrNotFound      = errors.New("token not found")
	ErrEncodingToken = errors.New("error encoding the token")
	ErrInvalidToken  = errors.New("invalid token provided")
)

type Provider interface {
	Generate(claims *UserClaims, opts ...GenerateOption) (*Token, error)
	Parse(token string) (*UserClaims, error)
	Refresh(token string) (*Token, error)
	ParseRSAPrivateKeyFromPEM() (*rsa.PrivateKey, error)
	String() string
}

type UserClaims struct {
	UserID int64 `json:"user_id"`
}

type Token struct {
	Token   string    `json:"token"`
	Refresh string    `json:"refresh"`
	Created time.Time `json:"created"`
	Expiry  time.Time `json:"expiry"`
}
